﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class Sales_DrawPrint : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (!string.IsNullOrEmpty(Request.QueryString["WageId"]))
            {
                ZSql zsql = new ZSql();
                hfgetid.Value = Server.UrlDecode(Request.Cookies["user"].Values["realname"]);
                string sql = "select WagesId,WStaffId,WStaffName,comodName,modul,WStaffSalary,WStaffPrice,WStaffPercentage,WStaffPerformance,WYWage,WSWage,WDiscount,WageDate,AuditUserName,convert(char(10),AuditDate,120) as AuditDate,department from CS_Wages  where WagesId='" + Request.QueryString["WageId"].ToString() + "'";
                zsql.Open(sql);
                DataTable dt = new DataTable();
                string strTable = "";
                dt = zsql.m_table;
                if (dt != null)
                {
                    if (dt.Rows.Count > 0)
                    {
                        strTable += "<div align=\"center\" style=\"width: 97%; font-size: 24px; font-weight: bolder; margin-bottom: 7px;\">员工工资单</div>";


                        strTable += "<table style=\"width: 97%;text-align:center;\" class=\"normal\"><tr><td width=\"4%\">员工基本信息</td><td width=\"14%\">员工名称：</td><td>" + zsql.m_table.Rows[0]["WStaffName"].ToString() + "</td><td width=\"10%\">所买商品：</td><td>" + zsql.m_table.Rows[0]["comodName"].ToString() + "</td><td width=\"5%\">类型：</td><td>" + zsql.m_table.Rows[0]["modul"].ToString() + "</td><td>所属部门：</td><td colspan=\"2\">" + zsql.m_table.Rows[0]["department"].ToString() + "</td></tr>";

                        strTable += "<tr><td width=\"10%\">工资序号</td><td width=\"10%\">基本工资</td><td width=\"10%\">员工奖金</td><td width=\"10%\">员工提成</td><td width=\"10%\">员工业绩</td><td width=\"10%\">应发工资</td><td width=\"10%\">扣除工资</td> <td width=\"10%\">实发工资</td><td width=\"10%\">业绩日期</td></tr>";

                        strTable += "<tr><td>" + zsql.m_table.Rows[0]["WagesId"].ToString() + "</td><td>" + zsql.m_table.Rows[0]["WStaffSalary"].ToString().Substring(0, zsql.m_table.Rows[0]["WStaffSalary"].ToString().Length - 2) + "元</td><td>" + zsql.m_table.Rows[0]["WStaffPrice"].ToString().Substring(0, zsql.m_table.Rows[0]["WStaffPrice"].ToString().Length - 2) + "元</td><td>" + zsql.m_table.Rows[0]["WStaffPercentage"].ToString() + "%</td><td>" + zsql.m_table.Rows[0]["WStaffPerformance"].ToString().Substring(0, zsql.m_table.Rows[0]["WStaffPerformance"].ToString().Length - 2) + "元</td><td>" + zsql.m_table.Rows[0]["WYWage"].ToString().Substring(0, zsql.m_table.Rows[0]["WYWage"].ToString().Length - 2) + "元</td><td>" + zsql.m_table.Rows[0]["WDiscount"].ToString().Substring(0, zsql.m_table.Rows[0]["WDiscount"].ToString().Length - 2) + "元</td><td>" + zsql.m_table.Rows[0]["WSWage"].ToString().Substring(0, zsql.m_table.Rows[0]["WSWage"].ToString().Length-2) + "元</td><td>" + zsql.m_table.Rows[0]["WageDate"].ToString() + "</td></tr>";

                        strTable += "<tr><td>结算时间：</td><td>" + zsql.m_table.Rows[0]["AuditDate"].ToString() + "</td><td colspan=\"5\"></td><td>操作员：</td><td>" + hfgetid.Value + "</td></tr></table>";


                    }
                }
                zsql.Close();
                lblTable.Text = strTable;
            }
        }
    }
}
